<template>
  <div class="app-container">
    <el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px">
      <el-form-item label="" prop="setmId">
        <el-select v-model="queryParams.setmId" placeholder="请选择体检套餐" clearable>
          <el-option v-for="item in setmealOptions" :key="item.setmId" :label="item.name" :value="item.setmId" />
        </el-select>
      </el-form-item>
      <!-- <el-form-item label="" prop="userName" v-hasRole="['admin', 'sysadmin']">
        <el-input v-model="queryParams.userName" placeholder="请输入预约用户" clearable @keyup.enter.native="handleQuery" />
      </el-form-item> -->
      <el-form-item label="" prop="resDatetime">
        <el-date-picker clearable v-model="queryParams.resDatetime" type="date" value-format="yyyy-MM-dd"
          placeholder="请选择预约时间">
        </el-date-picker>
      </el-form-item>
      <el-form-item label="" prop="isReserve">
        <el-select v-model="queryParams.isReserve" placeholder="请选择预约状态" clearable>
          <el-option v-for="dict in dict.type.reserve_state" :key="dict.value" :label="dict.label" :value="dict.value" />
        </el-select>
      </el-form-item>
      <el-form-item label="" prop="audit">
        <el-select v-model="queryParams.audit" placeholder="请选择预约审核" v-hasRole="['spadmin', 'doctor']" clearable>
          <el-option v-for="dict in dict.type.sys_audit" :key="dict.value" :label="dict.label" :value="dict.value" />
        </el-select>
      </el-form-item>
      <!-- <el-form-item label="" prop="tjRoute">
        <el-select v-model="queryParams.tjRoute" placeholder="请选择体检途径" clearable>
          <el-option v-for="dict in dict.type.health_examine" :key="dict.value" :label="dict.label" :value="dict.value" />
        </el-select>
      </el-form-item> -->
      <!-- <el-form-item label="" prop="tjType">
        <el-select v-model="queryParams.tjType" placeholder="请选择体检类型" clearable>
          <el-option v-for="dict in dict.type.health_examination_type" :key="dict.value" :label="dict.label"
            :value="dict.value" />
        </el-select>
      </el-form-item> -->
      <!-- <el-form-item label="" prop="isSubscribe" v-show="true">
        <el-select v-model="queryParams.isSubscribe" placeholder="请选择是否预约" clearable>
          <el-option v-for="dict in dict.type.subscribe_yes_no" :key="dict.value" :label="dict.label"
            :value="dict.value" />
        </el-select>
      </el-form-item> -->
      <el-form-item>
        <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
        <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
      </el-form-item>
    </el-form>

    <!-- <el-row :gutter="10" class="mb8">
      <el-col :span="1.5">
        <el-button type="primary" plain icon="el-icon-plus" size="mini" @click="handleAdd"
          v-hasPermi="['jktj:reserve:add']">新增</el-button>
      </el-col>
      <el-col :span="1.5">
        <el-button type="success" plain icon="el-icon-edit" size="mini" :disabled="single" @click="handleUpdate"
          v-hasPermi="['jktj:reserve:edit']">修改</el-button>
      </el-col>
      <el-col :span="1.5">
        <el-button type="danger" plain icon="el-icon-delete" size="mini" :disabled="multiple" @click="handleDelete"
          v-hasPermi="['jktj:reserve:remove']">删除</el-button>
      </el-col>
      <el-col :span="1.5">
        <el-button type="warning" plain icon="el-icon-download" size="mini" @click="handleExport"
          v-hasPermi="['jktj:reserve:export']">导出</el-button>
      </el-col>
      <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
    </el-row> -->

    <el-table border v-loading="loading" :data="reserveList" @selection-change="handleSelectionChange">
      <el-table-column type="selection" width="55" align="center" />
      <!-- <el-table-column label="id" align="center" prop="id" /> -->
      <el-table-column label="体检套餐" align="center" prop="jktjSetmeal.name" width="250" />
      <el-table-column label="套餐价格" align="center" prop="jktjSetmeal.price" />
      <!-- <el-table-column label="预约用户" align="center" prop="userName" /> -->
      <!-- <el-table-column label="体检用户" align="center" prop="tjUser" /> -->
      <el-table-column label="预约时间" align="center" prop="resDatetime" width="180">
        <template slot-scope="scope">
          <span>{{ parseTime(scope.row.resDatetime, '{y}-{m}-{d}') }}</span>
        </template>
      </el-table-column>


      <!-- <el-table-column label="体检途径" align="center" prop="tjRoute">
        <template slot-scope="scope">
          <dict-tag :options="dict.type.health_examine" :value="scope.row.tjRoute" />
        </template>
      </el-table-column> -->
      <!-- <el-table-column label="体检类型" align="center" prop="tjType">
        <template slot-scope="scope">
          <dict-tag :options="dict.type.health_examination_type" :value="scope.row.tjType" />
        </template>
      </el-table-column> -->

      <!-- <el-table-column label="是否预约" align="center" prop="isSubscribe">
        <template slot-scope="scope">
          <dict-tag :options="dict.type.subscribe_yes_no" :value="scope.row.isSubscribe" />
        </template>
      </el-table-column> -->
      <!-- <el-table-column label="联系方式" align="center" prop="userPhone" /> -->
      <!-- <el-table-column label="预约人数" align="center" prop="resNumber" /> -->


      <el-table-column label="剩余数量" align="center" prop="setmResidue" />
      <!-- <el-table-column label="操作" align="center" class-name="small-padding fixed-width" width="250">
        <template slot-scope="scope">
          <el-button size="small" type="success" icon="el-icon-edit" @click="handleUpdate(scope.row)"
            v-hasPermi="['jktj:reserve:edit']">修改</el-button>
          <el-button size="small" type="danger" icon="el-icon-delete" @click="handleDelete(scope.row)"
            v-hasPermi="['jktj:reserve:remove']">删除</el-button>
        </template>
      </el-table-column> -->
      <el-table-column label="预约状态" align="center" prop="isReserve">
        <template slot-scope="scope">
          <dict-tag :options="dict.type.reserve_state" :value="scope.row.isReserve" />
        </template>
      </el-table-column>
      <!-- <el-table-column label="预约审核" align="center" prop="audit" v-hasRole="['doctor', 'sysadmin']">
        <template slot-scope="scope">
          <dict-tag :options="dict.type.sys_audit" :value="scope.row.audit" />
        </template>
      </el-table-column> -->
      <!-- <el-table-column label="备注说明" align="center" prop="remark" /> -->
      <el-table-column label="操作" align="center" class-name="small-padding fixed-width" width="200">
        <template slot-scope="scope">
          <el-row>
            <el-col :span="2">

            </el-col>
            <el-col :span="20">
              <el-button size="small" type="info" icon="el-icon-alarm-clock" v-hasRole="['patient', 'sysadmin']"
                @click="handleReserve(scope.row)" v-hasPermi="['jktj:reserve:edit']">预约</el-button>
              <el-button size="small" type="primary" icon="el-icon-minus" v-hasRole="['sysadmin']"
                @click="handleSoldOut(scope.row)" v-hasPermi="['jktj:setmeal:edit']">下架</el-button>
            </el-col>
            <el-col :span="2">

            </el-col>
          </el-row>
          <el-row style="margin-top: 10px;">
            <el-col :span="2">

            </el-col>
            <el-col :span="20">
              <el-button size="small" type="warning" icon="el-icon-s-check" v-hasRole="['doctor', 'sysadmin']"
                @click="handleUpdate(scope.row)" v-hasPermi="['jktj:reserve:edit']">审核</el-button>
              <el-button size="small" type="danger" icon="el-icon-delete" @click="handleDelete(scope.row)"
                v-hasPermi="['jktj:reserve:remove']" v-hasRole="['admin', 'sysadmin']">删除</el-button>
            </el-col>
            <el-col :span="2">

            </el-col>
          </el-row>
          <!-- <el-button size="small" type="info" icon="el-icon-alarm-clock" @click="handleReserve(scope.row)"
            v-hasPermi="['jktj:reserve:edit']">预约</el-button>
          <el-button size="text" type="warning" icon="el-icon-minus" @click="handleSoldOut(scope.row)"
            v-hasPermi="['jktj:setmeal:edit']">下架</el-button>
          <el-button size="small" type="warning" icon="el-icon-s-check" @click="handleUpdate(scope.row)"
            v-hasPermi="['jktj:reserve:edit']">审核</el-button>
          <el-button size="small" type="danger" icon="el-icon-delete" @click="handleDelete(scope.row)"
            v-hasPermi="['jktj:reserve:remove']" v-hasRole="['admin', 'sysadmin']">删除</el-button> -->
        </template>
      </el-table-column>
    </el-table>

    <pagination v-show="total > 0" :total="total" :page.sync="queryParams.pageNum" :limit.sync="queryParams.pageSize"
      @pagination="getList" />

    <!-- 用户预约对话框 -->
    <el-dialog title="体检预约" :visible.sync="open1" width="640px" append-to-body>
      <el-form ref="form" :model="form" :rules="rules" label-width="80px">
        <el-row>
          <el-col :span="12">
            <el-form-item label="体检套餐" prop="setmId">
              <el-select :disabled="true" v-model="form.setmId" placeholder="请选择体检套餐">
                <el-option v-for="item in setmealOptions" :key="item.setmId" :label="item.name" :value="item.setmId" />
              </el-select>
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="预约状态" prop="isReserve">
              <el-select :disabled="true" v-model="form.isReserve" placeholder="请选择预约状态">
                <el-option v-for="dict in dict.type.reserve_state" :key="dict.value" :label="dict.label"
                  :value="parseInt(dict.value)"></el-option>
              </el-select>
            </el-form-item>
          </el-col>
        </el-row>
        <el-row>
          <el-col :span="12">

            <el-form-item label="用户姓名" prop="tjUser">
              <el-input v-model="form.tjUser" placeholder="请输入体检用户" />
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="联系方式" prop="userPhone">
              <el-input v-model="form.userPhone" placeholder="请输入联系方式" />
            </el-form-item>
          </el-col>
        </el-row>
        <el-row>
          <el-col :span="12">
            <el-form-item label="体检途径" prop="tjRoute">
              <el-select v-model="form.tjRoute" placeholder="请选择体检途径">
                <el-option v-for="dict in dict.type.health_examine" :key="dict.value" :label="dict.label"
                  :value="dict.value"></el-option>
              </el-select>
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="体检类型" prop="tjType">
              <el-select v-model="form.tjType" placeholder="请选择体检类型">
                <el-option v-for="dict in dict.type.health_examination_type" :key="dict.value" :label="dict.label"
                  :value="dict.value"></el-option>
              </el-select>
            </el-form-item>
          </el-col>
        </el-row>
        <el-row>
          <el-col :span="12">
            <el-form-item label="预约时间" prop="resDatetime">
              <el-date-picker clearable v-model="form.resDatetime" type="date" value-format="yyyy-MM-dd"
                placeholder="请选择预约时间">
              </el-date-picker>
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="预约人数" prop="resNumber">
              <el-input v-model="form.resNumber" placeholder="请输入预约人数" />
            </el-form-item>
          </el-col>
        </el-row>
        <el-form-item label="备注说明" prop="remark">
          <el-input type="textarea" v-model="form.remark" placeholder="请输入备注说明" />
        </el-form-item>
      </el-form>
      <div slot="footer" class="dialog-footer">
        <el-button type="success" :disabled="btnDisabled" @click="submitReserveForm">确定预约</el-button>
        <!-- <el-button @click="cancel">取消预约</el-button> -->
      </div>
    </el-dialog>

    <!-- 添加或修改套餐预约对话框 -->
    <el-dialog :title="title" :visible.sync="open" width="320px" append-to-body>
      <el-form ref="form" :model="form" :rules="rules" label-width="80px">
        <el-form-item label="体检套餐" prop="setmId">
          <el-select :disabled="true" v-model="form.setmId" placeholder="请选择体检套餐">
            <el-option v-for="item in setmealOptions" :key="item.setmId" :label="item.name" :value="item.setmId" />
          </el-select>
        </el-form-item>
        <!-- <el-form-item label="套餐价格" prop="setmPrice">
          <el-input v-model="form.setmPrice" placeholder="请输入套餐价格" />
        </el-form-item> -->
        <!-- <el-form-item label="预约用户" prop="userName">
          <el-input v-model="form.userName" placeholder="请输入预约用户" />
        </el-form-item> -->
        <!-- <el-form-item label="预约时间" prop="resDatetime">
          <el-date-picker clearable v-model="form.resDatetime" type="date" value-format="yyyy-MM-dd"
            placeholder="请选择预约时间">
          </el-date-picker>
        </el-form-item> -->
        <!-- <el-form-item label="剩余数量" prop="setmResidue">
          <el-input v-model="form.setmResidue" placeholder="请输入剩余数量" />
        </el-form-item> -->
        <!-- <el-form-item label="预约状态" prop="isReserve">
          <el-select v-model="form.isReserve" placeholder="请选择预约状态">
            <el-option v-for="dict in dict.type.reserve_state" :key="dict.value" :label="dict.label"
              :value="parseInt(dict.value)"></el-option>
          </el-select>
        </el-form-item> -->

        <!-- <el-form-item label="体检途径" prop="tjRoute">
          <el-select v-model="form.tjRoute" placeholder="请选择体检途径">
            <el-option v-for="dict in dict.type.health_examine" :key="dict.value" :label="dict.label"
              :value="dict.value"></el-option>
          </el-select>
        </el-form-item> -->
        <!-- <el-form-item label="体检类型" prop="tjType">
          <el-select v-model="form.tjType" placeholder="请选择体检类型">
            <el-option v-for="dict in dict.type.health_examination_type" :key="dict.value" :label="dict.label"
              :value="dict.value"></el-option>
          </el-select>
        </el-form-item> -->

        <el-form-item label="预约用户" prop="tjUser">
          <el-input :disabled="true" v-model="form.tjUser" placeholder="请输入体检用户" />
        </el-form-item>
        <!-- <el-form-item label="是否预约" prop="isSubscribe">
          <el-select v-model="form.isSubscribe" placeholder="请选择是否预约">
            <el-option v-for="dict in dict.type.subscribe_yes_no" :key="dict.value" :label="dict.label"
              :value="dict.value"></el-option>
          </el-select>
        </el-form-item> -->
        <el-form-item label="联系方式" prop="userPhone">
          <el-input :disabled="true" v-model="form.userPhone" placeholder="请输入联系方式" />
        </el-form-item>
        <el-form-item label="预约人数" prop="resNumber">
          <el-input :disabled="true" v-model="form.resNumber" placeholder="请输入预约人数" />
        </el-form-item>
        <el-form-item label="预约审核" prop="audit">
          <el-radio-group v-model="form.audit">
            <el-radio v-for="dict in dict.type.sys_audit" :key="dict.value" :label="dict.value">{{ dict.label
            }}</el-radio>
          </el-radio-group>
        </el-form-item>
        <!-- <el-form-item label="备注说明" prop="remark">
          <el-input v-model="form.remark" placeholder="请输入备注说明" />
        </el-form-item> -->
      </el-form>
      <div slot="footer" class="dialog-footer">
        <el-button type="primary" @click="submitAuditForm">确 定</el-button>
        <el-button @click="cancel">取 消</el-button>
      </div>
    </el-dialog>
  </div>
</template>

<script>

import { listReserve, getReserve, delReserve, addReserve, updateReserve } from "@/api/jktj/reserve";
import { listSetmeal, getSetmeal, delSetmeal, addSetmeal, updateSetmeal } from "@/api/jktj/setmeal";
import { getUserProfile, updateUserProfile } from "@/api/system/user";
import { listEntering, getEntering, delEntering, addEntering, updateEntering } from "@/api/jktj/entering";
import { listCheckgroup, getCheckgroup, delCheckgroup, addCheckgroup, updateCheckgroup } from "@/api/jktj/checkgroup";

export default {
  name: "Reserve",
  dicts: ['health_examination_type', 'subscribe_yes_no', 'health_symptom', 'health_examine', 'reserve_state', 'sys_audit'],
  data () {
    return {
      status: '未预约',
      Residue: 0,
      setmealId: [],
      btnDisabled: false,
      // 遮罩层
      loading: true,
      // 选中数组
      ids: [],
      // 非单个禁用
      single: true,
      // 非多个禁用
      multiple: true,
      // 显示搜索条件
      showSearch: true,
      // 总条数
      total: 0,
      // 套餐预约表格数据
      reserveList: [],
      // 套餐选择列表
      setmealOptions: [],
      // 弹出层标题
      title: "",
      // 是否显示弹出层
      open: false,
      open1: false,
      //当前用户
      crruentUser: this.$store.state.user.nickName,
      //当前角色
      crruentRole: this.$store.state.user.roles[0],
      // 查询参数
      queryParams: {
        pageNum: 1,
        pageSize: 10,
        setmId: null,
        userName: null,
        resDatetime: null,
        isReserve: null,
        audit: null,
        tjRoute: null,
        tjType: null,
        isSubscribe: null,
      },
      // 表单参数
      form: {},
      // 
      enteringForm: {
        entId: null,
        setmId: null,
        doctor: null,
        tjUser: null,
        userSex: null,
        identityCard: null,
        tjType: null,
        inspect: [],
        symptom: [],
        phone: null,
        healthAssess: null,
        doctorAdvice: null,
        remark: null,
        satisficing: null,
        user: null,
        jktjCheckInfoList: [],
      },
      jktjCheckInfoList: [],
      queryCheckGroup: {
        setmId: null
      },
      // 表单校验
      rules: {
      }
    };
  },
  created () {
    this.getList();
    this.getAllSetmealList();
  },
  methods: {
    // 获取所有套餐详情
    getAllSetmealList () {
      listSetmeal().then(response => {
        this.setmealOptions = response.rows;
      });

    },
    /** 查询套餐预约列表 */
    getList () {
      // this.loading = true;
      // if (this.crruentRole == 'sysadmin' || this.crruentRole == 'admin') {

      // }
      // else {
      //   this.queryParams.isSubscribe = '1';
      // }
      this.queryParams.isSubscribe = '1';
      // this.queryParams.userName = this.$store.state.user.name;
      listReserve(this.queryParams).then(response => {
        this.reserveList = response.rows;
        this.total = response.total;
        this.loading = false;
      });
      // console.log(this.crruentRole)
    },
    // 取消按钮
    cancel () {
      this.open = false;
      this.reset();
    },
    // 表单重置
    reset () {
      this.form = {
        id: null,
        setmId: null,
        setmPrice: null,
        userName: null,
        resDatetime: null,
        setmResidue: null,
        isReserve: null,
        audit: null,
        tjRoute: null,
        tjType: null,
        tjUser: null,
        isSubscribe: null,
        userPhone: null,
        resNumber: 1,
        createBy: null,
        createTime: null,
        updateBy: null,
        updateTime: null,
        remark: null
      };
      this.resetForm("form");
    },
    /** 搜索按钮操作 */
    handleQuery () {
      this.queryParams.pageNum = 1;
      this.getList();
    },
    /** 重置按钮操作 */
    resetQuery () {
      this.resetForm("queryForm");
      this.handleQuery();
    },
    // 多选框选中数据
    handleSelectionChange (selection) {
      this.ids = selection.map(item => item.id)
      this.single = selection.length !== 1
      this.multiple = !selection.length
    },
    /** 新增按钮操作 */
    handleAdd () {
      this.reset();
      this.open = true;
      this.title = "添加套餐预约";
    },
    //
    handleSoldOut (row) {
      this.form = row;
      this.form.isSubscribe = '0'
      updateReserve(this.form).then(response => {
        this.$modal.msgSuccess("下架成功！");
        this.open1 = false;
        this.getList();
      });
    },
    //
    handleReserve (row) {
      this.reset();
      const id = row.id || this.ids
      getReserve(id).then(response => {
        this.form = response.data;
        this.Residue = this.form.setmResidue
        console.log(this.Residue)
        this.open1 = true;
        if (this.form.isReserve == 0 || this.form.isReserve == 5 || this.form.isReserve == 6) {
          this.btnDisabled = false;
        } else {
          this.btnDisabled = true;
        }
        // this.title = "预约审核";
      });
    },
    /** 修改按钮操作 */
    handleUpdate (row) {
      this.reset();
      const id = row.id || this.ids
      getReserve(id).then(response => {
        this.form = response.data;
        // this.form.audit = null;
        this.open = true;
        this.title = "预约审核";
      });
    },
    // 提交预约表单
    submitReserveForm () {
      this.$refs["form"].validate(valid => {
        if (valid) {
          if (this.form.id != null) {
            this.form.isReserve = 2;
            this.form.audit = 4;
            this.form.setmResidue = this.Residue - this.form.resNumber
            // console.log(this.form.setmResidue)
            getUserProfile().then(response => {
              this.form.user = response.data.userName;
              this.form.userName = response.data.userName;
              updateReserve(this.form).then(response => {
                this.$modal.msgSuccess("正在受理中···");
                this.open1 = false;
                this.getList();
              });
            })

          }
        }
      });
    },
    // 提交审核表单
    submitAuditForm () {
      this.$refs["form"].validate(valid => {
        if (valid) {
          if (this.form.id != null) {
            // 拒绝
            if (this.form.audit == 0) {
              //重新预约
              this.form.isReserve = 6;
            }
            // 通过
            if (this.form.audit == 1) {
              // 预约成功
              this.form.isReserve = 3;
              this.enteringForm.setmId = this.form.setmId;
              this.enteringForm.tjUser = this.form.tjUser;
              this.enteringForm.phone = this.form.userPhone;
              this.enteringForm.doctor = this.crruentUser;
              this.enteringForm.user = this.form.userName;
              this.enteringForm.inspect = '0';
              this.enteringForm.symptom = '0';
              this.queryCheckGroup.setmId = this.setmId;
              listCheckgroup(this.queryCheckGroup).then(response => {
                for (var i = 0; i < response.rows.length; i++) {
                  let obj = {};
                  obj.checkInfo = response.rows[i].jktjCheck.checkName;
                  obj.checkResult = ""
                  obj.unit = response.rows[i].checkUnit;
                  obj.tjDoctor = "";
                  obj.setmId = "";
                  obj.img = "";
                  this.jktjCheckInfoList.push(obj);

                }
                this.enteringForm.jktjCheckInfoList = this.jktjCheckInfoList;
                addEntering(this.enteringForm).then(response => {
                  console.log(this.enteringForm)
                })
                // console.log(this.enteringForm.jktjCheckInfoList)
                // console.log(this.enteringForm)
              })
              // this.enteringForm.jktjCheckInfoList = this.jktjCheckInfoList;
              // addEntering(this.enteringForm).then(response => {
              //   console.log(this.enteringForm)
              // })
            }
            // 其他
            if (this.form.audit == 2) {
              // 已预约
              this.form.isReserve = 2;
            }
            // 满员
            if (this.form.audit == 3) {
              // 预约中
              this.form.isReserve = 1;
            }
            // this.form.isReserve = 1;
            updateReserve(this.form).then(response => {
              this.$modal.msgSuccess("操作成功");
              this.open = false;
              this.getList();
            });
          }
        }
      });
    },
    /** 提交按钮 */
    submitForm () {
      this.$refs["form"].validate(valid => {
        if (valid) {
          if (this.form.id != null) {
            updateReserve(this.form).then(response => {
              this.$modal.msgSuccess("修改成功");
              this.open = false;
              this.getList();
            });
          } else {
            getUserProfile().then(response => {
              this.form.userName = response.data.userName;
              addReserve(this.form).then(response => {
                this.$modal.msgSuccess("新增成功");
                this.open = false;
                this.getList();
              });
            })
            // addReserve(this.form).then(response => {
            //   this.$modal.msgSuccess("新增成功");
            //   this.open = false;
            //   this.getList();
            // });
          }
        }
      });
    },
    /** 删除按钮操作 */
    handleDelete (row) {
      const ids = row.id || this.ids;
      this.$modal.confirm('是否确认删除该预约信息？').then(function () {
        return delReserve(ids);
      }).then(() => {
        this.getList();
        this.$modal.msgSuccess("删除成功");
      }).catch(() => { });
    },
    /** 导出按钮操作 */
    handleExport () {
      this.download('jktj/reserve/export', {
        ...this.queryParams
      }, `reserve_${new Date().getTime()}.xlsx`)
    }
  }
};
</script>
